package com.fresh.liangyi.controller.client;

import com.fresh.liangyi.model.domain.Goods;
import com.fresh.liangyi.model.domain.Menu;
import com.fresh.liangyi.service.GoodsService;
import com.fresh.liangyi.service.MenuService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    private GoodsService goodsService;
    @Autowired
    private MenuService menuService;
    @GetMapping(value = {"/","/index"})
    public String index(Model model){
        List<Goods> goodsList=goodsService.selectGoodsAll();
        model.addAttribute("goodsList",goodsList);
        List<Menu> menuList=menuService.selectMenuAll();
        model.addAttribute("menuList",menuList);
        return "client/index";
    }

}
